<template>
	<view>
		
	<form @submit="formSubmit">
		<view class="content">
			<label class="lable">*原铁水碳含量%:</label>
			<input  placeholder="请输入" type="number" :value="dlplssbz.cBz" name="cBz" class="v_input"  />
			<!-- <text class="v_input">{{dlplssbz.cBz}}</text> -->
		</view>
		
		<view class="content">
			<label class="lable">*原铁水硅含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.siBz" name="siBz"  class="v_input"/>
			<!-- <text class="v_input">{{dlplssbz.siBz}}</text> -->
		</view>
		
		<view class="content">
			<label class="lable">增碳剂碳吸收率%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.cXsl" name="cXsl"  class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">增碳剂有效成分含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.cYxcfhl" name= "cYxcfhl"  class="v_input"/>
		</view>
		<view class="content">
			<label class="lable">硅铁吸收率%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.siXsl" name= "siXsl"  class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">硅铁有效成分含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.siYxcfhl" name= "siYxcfhl"  class="v_input"/>
		</view>
		<view class="content">
			<label class="lable">废钢碳含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.fgChl" name= "fgChl" class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">废钢硅含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.fgSihl" name= "fgSihl" class="v_input"/>
		</view>
		<view class="content">
			<label class="lable">生铁碳含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.stChl" name= "stChl" class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">生铁硅含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.stSihl" name= "stSihl"  class="v_input"/>
		</view>
		<view class="content">
			<label class="lable">回炉料碳含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.hllChl" name= "hllChl" class="v_input"/>
		</view>
		
		<view class="content">
			<label class="lable">回炉料硅含量%:</label>
			<input placeholder="请输入" type="number" :value="dlplssbz.hllSihl" name= "hllSihl"  class="v_input"/>
		</view>
		<view style="display: flex;">
			<button form-type="submit" class="btnself">保存</button>
		</view>
	</form>
		
	</view>
</template>

<script>
	import configService from '@/common/config.service.js';
	const apiUrl = configService.apiUrl;
	export default {
		data() {
			return {
				dlplssbz: [],
				
			}
		},
		onShow:function(e){
			this.$verify.verify();
		},
		onLoad() {
			this.getPlssBz();
		},
		methods: {
			getPlssBz(){
				uni.request({
					url:apiUrl+'/dlplss/list',
					header:{
						'content-type':'application/json'
					},
					method:'POST',
					data:{
						deptId:uni.getStorageSync("deptId"),type: 3
					},
					success: (res) => {
						if(res.statusCode === 200 &&  res.data.data.length > 0)
						{
							this.dlplssbz = res.data.data[0];
						}
					}
				})
			},
			formSubmit(e) {
				let formData = e.detail.value;
				if(Object.values(formData).some(value => value === "")){
					uni.showToast({
						title: "请维护所有元素标准！",
						icon:'error',
						duration:1000
					});
					return ;
				}
					uni.request({
						url: apiUrl+'/dlplss/edit',
						data:{...this.dlplssbz,...formData, ...{deptId:uni.getStorageSync("deptId"),type: 3}},
						header: {
							'content-type': 'application/json' //自定义请求头信息
						},
						method : 'POST',

						success: (res) => {
							if(res.statusCode === 200)
							{
								uni.showToast({
									title: '成功',
									icon:'success',
									duration:1000
								});
								setTimeout(() => {
									uni.redirectTo({
									    url: '/pages/index/index'
									});
								}, 1000)
							}else{
								uni.showToast({
									title: title,
									icon:'erro',
									duration:2500
								});
							}
						}
				});
			}
		}
	}
</script>

<style>
@import url("@/common/bzwhht.css");
.btnself{
	color: white;
	background: #3662EC;
	width: 90%;
	margin-left: 5%;
	margin-top: 5%;
	margin-bottom: 9%;
}
</style>
